<?php
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 2020/10/18
 * Time: 3:23 PM
 */
namespace app\admin\controller;


use app\admin\logic\GoodsLogic;
use app\admin\logic\IntegralLogic;
use app\admin\logic\VideoLogic;
use app\BaseController;

use think\App;
use think\facade\Request;

class Video extends BaseController
{

    public function __construct()
    {
//        logend(config('user'));
//        if(config('user')['position'] != \app\model\User::SYS_ADMIN)   fail('暂无权限');
    }

    /*
     * 列表
     */
    public function index()
    {
        $logic = new VideoLogic();
        success($logic->getList());
    }

    /*
     * 添加
     */
    public function create()
    {
        $logic = new VideoLogic();
        success($logic->addVideo());
    }
    public function update()
    {
        $logic = new VideoLogic();
        success($logic->updateVideo());
    }
    /*
     * 删除
     */
    public function del()
    {

        $param = Request::delete();
        if(!isset($param['videoId']) || empty($param['videoId']))   fail('请选择视频');
        $videoId = intval($param['videoId']);

        $logic = new VideoLogic();
        success($logic->del($videoId));
    }

}